home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / rhythmbox / plugins / dontreallyclose / dontreallyclose.py next >
Encoding:
Python Source  |  2009-04-07  |  1.4 KB  |  43 lines

  1. # -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
  2. #
  3. # Copyright (C) 2008 Jonathan Matthew
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
  18.  
  19.  
  20. # this plugin is more license than plugin.
  21.  
  22. import rb
  23. import gconf
  24.  
  25. class DontReallyClosePlugin(rb.Plugin):
  26.     def __init__(self):
  27.         rb.Plugin.__init__(self)
  28.         self.delete_event_id = 0
  29.  
  30.     def delete_event_cb(self, widget, event):
  31.         widget.hide()
  32.         gconf.client_get_default().set_bool("/apps/rhythmbox/state/window_visible", 0)
  33.         return True
  34.  
  35.     def activate(self, shell):
  36.         self.delete_event_id = shell.props.window.connect('delete-event', self.delete_event_cb)
  37.  
  38.     def deactivate(self, shell):
  39.         if self.delete_event_id != 0:
  40.             shell.props.window.disconnect(self.delete_event_id)
  41.             self.delete_event_id = 0
  42.  
  43.